home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / turlwi10.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  2.5 KB  |  90 lines

  1. //    Copyright (c) 1994, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TURLWindow
  4. //    Include File:    turlwind.h
  5. //    Purpose:    Provide a window for a view for a URL
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        03-29-94    created
  9. #define Uses_TInputLine
  10. #define Uses_TLabel
  11. #define Uses_THistory
  12. #define Uses_TProgram
  13. #define Uses_TDeskTop
  14. #define Uses_TDialog
  15. #define Uses_TButton
  16. #include"turlwind.h"
  17.  
  18. void TURLWindow::IndexQuery()    {
  19. //    Purpose:    Query the user for and index search string.
  20. //    Arguments:    void
  21. //    Return Value:    void
  22. //    Remarks/Portability/Dependencies/Restrictions:
  23. //    Revision History:
  24. //        03-29-94    created
  25.  
  26.     //    First, check to make sure is a searchable index.
  27.     if(B_isIndex == False)    {
  28.         doslynxmessage("View is not a searchable index.");
  29.         return;
  30.     }
  31.  
  32.     //    General use rectangle.
  33.     auto TRect TR(0, 0, 50, 7);
  34.  
  35.     //    Create a dialog that asks for the search string.
  36.     TDialog *TDp_index = new TDialog(TR, "Searchable Index");
  37.     if(TDp_index == NULL)    {
  38.         doslynxmessage("Unable to create index dialog.");
  39.         return;
  40.     }
  41.  
  42.     //    Set some dialog options.
  43.     TDp_index->options |= ofCentered;
  44.  
  45.     //      Make the input line to enter the dos device to print to.
  46.     TR = TRect(6, 2, 44, 3);
  47.     TInputLine *TILp_searchString = new TInputLine(TR, usi_TILURLSize - 1);
  48.     TDp_index->insert(TILp_searchString);
  49.  
  50.  
  51.     //    Make the input line's label.
  52.     TR = TRect(5, 1, 27, 2);
  53.     TLabel *TLp_prompt = new TLabel(TR, "~E~nter a Search String",
  54.         TILp_searchString);
  55.     TDp_index->insert(TLp_prompt);
  56.  
  57.     //    Make the input line's history.
  58.     TR = TRect(45, 2, 48, 3);
  59.     THistory *THp_indexHist = new THistory(TR, TILp_searchString,
  60.         usi_IndexHist);
  61.     TDp_index->insert(THp_indexHist);
  62.  
  63.     //    Insert the Ok and Cancel buttons.
  64.     auto TButton *TBp_button;
  65.     TR = TRect(9, 4, 21, 6);
  66.     TBp_button = new TButton(TR, "~O~K", cmOK, bfDefault);
  67.     TDp_index->insert(TBp_button);
  68.     TR = TRect(24, 4, 36, 6);
  69.     TBp_button = new TButton(TR, "~C~ancel", cmCancel, bfNormal);
  70.     TDp_index->insert(TBp_button);
  71.  
  72.     //    Stay in the device name field.
  73.     TDp_index->selectNext(False);
  74.  
  75.     //    Draw the dialog.
  76.     TDp_index->drawView();
  77.  
  78.     //    Execute the dialog.
  79.     if(TProgram::deskTop->execView(TDp_index) != cmCancel)    {
  80.         //    User didn't cancel, save what we got and attempt
  81.         //    the load.
  82.         auto char ca_buffer[usi_TILURLSize];
  83.         TILp_searchString->getData(ca_buffer);
  84.         URLoader(TURLV->getURL(), ca_buffer);
  85.     }
  86.  
  87.     //    Done with dialog.
  88.     destroy(TDp_index);
  89.     return;
  90. }